package cn.fenqing168.springcloud.service.impl;

import cn.fenqing168.springcloud.dao.StorageDao;
import cn.fenqing168.springcloud.service.IStorageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
 * @author fenqing
 */
@Service
@Slf4j
public class StorageServiceImpl implements IStorageService {

    @Autowired
    private Dao dao;

    @Component
    class Dao{
        @Autowired
        private StorageDao storageDao;
    }

    @Override
    public void decrease(Long productId, Integer count) {
        log.info("开始减少产品id为{}的库存,减少库存数额为{}", productId, count);
        dao.storageDao.decrease(productId, count);
        log.info("减少产品id为{}的库存成功,减少库存数额为{}", productId, count);
    }
}
